1. Field of the Invention
The present invention relates to an image processing apparatus, and, more particularly to an image processing apparatus that quantizes pixel values of respective pixels of an image signal, a gradation converting device for the quantization, a processing method for the image processing apparatus and the gradation converting device, and a computer program for causing a computer to execute the method.
2. Description of the Related Art
In digital video display in digital camcorders, computer graphics, animations, and the like, the number of bits of a gradation of a material and the number of bits of a display apparatus or the number of bits on a digital transmission interface such as an HDMI (High-Definition Multimedia Interface) or a DVI (Digital Visual Interface) do not always coincide with each other. In signal processing in an apparatus that treats a digital video signal, a calculation process of the processing and the number of transmitted bits of video signal data in the apparatus may be different.
FIG. 20 is a block diagram of the numbers of bits of respective components and the number of bits on a bus until a digital image is displayed on a display apparatus. In FIG. 20, an image processing unit 811, a pixel-density converting unit 812, a color-mode converting unit 813, a panel control unit 814, and a display unit 815 are shown. An image signal inputted to the image processing unit 811 is sequentially processed and finally displayed on the display unit 815. In this case, it is seen that the numbers of bits of processing in the respective components and the numbers of bits of signal lines of the bus connecting the respective components are different. For example, whereas calculation in the panel control unit 814 is performed with 10 bits, an input signal to and an output signal from the panel control unit 814 are 8-bit RGB signals. The number of input and output signals and the number of bits of the internal calculation are different. In such a case, conversion of the number of bits is necessary as gradation conversion. As methods generally used for the conversion of the number of bits, there are bit shift for simply shifting the number of bits by a necessary number of bits and a method of, for example, once dividing the number of bits by the number of bits before conversion to normalize the number of bits to a value between 0 to 1 in order to expand quantization steps to equal interval and then multiplying the number of bits with a necessary number of bits.
FIG. 21 is a diagram of gradation conversion from 10 bits to 8 bits by the bit shift. In FIG. 21, 10-bit gradation representation 820 and 8-bit gradation representation 830 after the bit shift are shown. In this case, the number of bits is converted from 10 bits into 8 bits by moving 8 bits (higher order 8 bits) on the left to the right by 2 bits (omitting lower order 2 bits).
However, when the lower order 2 bits are omitted in this way, in an image with smooth gradation and a flat image with a little change of a gray scale such as an image of the blue sky in a sunny day, steps called banding or Mach band may appear because of the influence of the human visual characteristic.
Such quantization errors due to a reduction in the number of bits cause deterioration in an image quality. As measures against the quantization errors, in general, methods called a dither method and an error diffusion method are used. These methods are methods of adding PDM (Pulse Depth Modulation) noise to a boundary of the banding to thereby making the steps less conspicuous.
FIGS. 22A to 22C are graphs of a change in a pixel value that occurs when the PDM noise is added to the bit shift from 10 bits to 8 bits. In FIGS. 22A to 22C, the abscissa indicates coordinates in the horizontal direction in an image and the ordinate indicates pixel values in the respective coordinates. A level of the pixel value on the ordinate is set to 0 to 8 for convenience of illustration. FIG. 22A is a graph of a pixel value of a gray scale image quantized to 10 bits. In FIG. 22A, the level of the pixel value gradually increases by one level at a time from the left to the right in the horizontal direction. FIG. 22B is a graph of an example of a pixel value of an image quantized to 8 bits by omitting lower order 2 bits of the 10-bit gray scale image shown in FIG. 22A. In this case, a state of the pixel value substantially changing stepwise is seen. FIG. 22C is a graph of a change in a pixel value of an image obtained by adding the PDM noise to the image, the number of bits of which is converted into 8 bits, shown in FIG. 22B. In this case, it is seen that noise, a pixel value of which changes in a pulse-like manner, is added and intervals among the pieces of noise are narrowed in coordinates closer to steps. The steps are made less conspicuous by changing the pixel value in a pulse-like manner and changing the pulse intervals. The influence due to the addition of the PDM noise is explained with reference to the following diagrams in an example of an actual gray scale image.
FIGS. 23A to 23D are diagrams of images formed when the PDM noise is added to the bit shift from 10 bits to 8 bits. FIG. 23A is a diagram of an image of a 10-bit gray scale. Although a pixel value does not change in the vertical direction, a pixel value gradually changes in the horizontal direction. FIG. 23B is a diagram of an image formed by converting the 10-bit gray scale image into 8 bits by omitting lower order 2 bits. In this case, a state of the pixel value steeply changing is clearly seen. FIGS. 23C and 23D are diagrams of images formed by adding the PDM noise to the gray scale image quantized to 8 bits shown in FIG. 23B. In both FIGS. 23C and 23D, it is seen that steps are inconspicuous. The image shown in FIG. 23C is formed by the dither method and the image shown in FIG. 23D is formed by the error diffusion method. The dither method and the error diffusion methods are substantially different in that, whereas noise is added regardless of the human visual characteristic in the dither method, noise is added taking into account the human visual characteristic in the error diffusion method. As a representative two-dimensional filter used for the error diffusion method, a Jarvis, Judice & Ninke's filter (hereinafter referred to as Jarvis filter) and a Floyd & Steinberg's filter (hereinafter referred to as Floyd filter) are known (see, for example, Hitoshi Kiya, “Yokuwakaru Digital Image Processing”, Sixth edition, CQ publishing Co., Ltd., January 2000, p. 196 to 213).
In order to represent the human visual characteristic, a contrast sensitivity curve representing a spatial frequency f [unit: cpd (cycle/degree)] on the abscissa and representing contrast sensitivity on the ordinate is used. The spatial frequency represents the number of stripes that can be displayed per unit angle (1 degree in angle of field) with respect to the angle of field. A maximum frequency in the spatial frequency depends on pixel density (the number of pixels per unit length) of a display apparatus and a viewing distance.
FIGS. 24A and 24B are diagrams concerning calculation of the maximum frequency in the spatial frequency in the display apparatus. In FIGS. 24A and 24B, an angle θ represents 1 degree in angle of field and a viewing distance D represents a distance between the display apparatus and a viewer as shown in FIG. 24B. Width “d” on a display screen with respect to 1 degree in angle of field is calculated from the angle θ and the viewing distance D by using the following relational expression:tan(θ/2)=(d/2)/D 
The maximum frequency in the spatial frequency as the number of stripes on the display screen per 1 degree in angle of field can be calculated by dividing the width “d” on the display screen by length per two pixels (the two pixels form one set of stripes) calculated from the pixel density of the display screen.
When, for example, a high-resolution printer having the maximum frequency of about 120 cpd is assumed as the display apparatus, as shown in FIG. 25A, it is possible to modulate quantization errors to a frequency band that is less easily sensed in a human vision characteristic 840 even by the Jarvis filter 851 and the Floyd filter 852. Amplitude characteristics of these representative filters are different. In general, the Jarvis filter is used when importance is attached to a low frequency band and the Floyd filter is used when a higher frequency is treated.
However, when a high-definition display having 1920 pixels×1080 pixels in the horizontal and vertical directions is assumed as the display apparatus, the maximum frequency per unit angle with respect to the angle of field is about 30 cpd. As shown in FIG. 25B, it is seen that it is difficult to modulate the quantization errors to a band with sufficiently low sensitivity with respect to the human visual characteristic 840 using the Jarvis Filter 851 and the Floyd filter 852. Such a situation is caused because, whereas a sampling frequency depends on pixel density of the display apparatus, the human visual characteristic has a peculiar value.